package controller.api;
import com.jfinal.aop.Before;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Ret;

import common.inter.ServicerStationInter;
import common.inter.StaffStationInter;
import model.MonitoringStation;
import service.MonitoringStationService;

public class ApiMonitoringStationController extends BaseApiController {
	@Inject MonitoringStationService monitoringStationService ;

	@Before(ServicerStationInter.class)
	public void info() {
		Long stationId = getParaToLong("id");
		MonitoringStation monitoringStation = MonitoringStation.dao.findFirstByStationId(stationId);
        set("data", monitoringStation );
        renderJson();
	}

	@Before(StaffStationInter.class)
	public void save() {
		MonitoringStation monitoringStation = getModel(MonitoringStation.class , "x");
        Ret ret = monitoringStationService.save(monitoringStation  , getStation() , getStaff() );
        renderJson(ret);
	}
}
